<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015-6-17
 * Time: 14:28
 */

namespace doumiaoduo\ueditor\actions;


use yii\base\Action;
use yii\web\Response;
use doumiaoduo\ueditor\UploaderHelper;

class ImageUploadMultipleAction extends Action{


    private $_config;

    public function init(){
        $this->_config=\Yii::$app->params['ueditor'];
        parent::init();
    }



    public function run(){
        \Yii::$app->response->format=Response::FORMAT_JSON;
        $config = array(
            "pathFormat" => $this->_config['imagePathFormat'],
            "maxSize" => $this->_config['imageMaxSize'],
            "allowFiles" => $this->_config['imageAllowFiles']
        );
        $fieldName = $this->_config['imageFieldName'];

        $up=new UploaderHelper($fieldName,$config);
        return $up->getFileInfo();

    }


}